﻿using MongoDB.Bson;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MongoDB.Bson.Serialization.Attributes;
using System.Runtime.Serialization;

namespace LightSO.ILibrary
{
    /// <summary>
    /// 实体类接口
    /// </summary>
	[DataContract]
    public abstract partial class EntityBase
    {
        [BsonElement("_id")]
        [DapperQ.Mapping.Exclude]
        public ObjectId UUID { get; set; }
    }

    public class ObjectIdComparer : IEqualityComparer<ObjectId>
    {
        // Products are equal if their names and product numbers are equal.
        public bool Equals(ObjectId x, ObjectId y)
        {
            return x.Equals(y);
        }

        // If Equals() returns true for a pair of objects
        // then GetHashCode() must return the same value for these objects.

        public int GetHashCode(ObjectId objectid)
        {
            return objectid.GetHashCode();
        }

    }
}


